<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <title>{:config('WEB_SITE_TITLE')}管理系统</title>
    <link href="__CSS__/bootstrap.min.css" rel="stylesheet">
    <link href="__CSS__/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__CSS__/animate.min.css" rel="stylesheet">
    <link href="__CSS__/style.min.css" rel="stylesheet">
    <link href="__CSS__/login.min.css" rel="stylesheet">
    <link href="__CSS__/jquery.slider.css" rel="stylesheet">
    <script type="text/javascript" src="__JS__/jquery.min.js?v=2.1.4"></script>
    <script>
        if (window.top !== window.self) {
            window.top.location = window.location
        };
    </script>
</head>

<body class="signin">
    <div class="signinpanel">
        <div class="row">
            <div class="col-sm-7" style="color:#fff">
                <div class="signin-info">
                    <div class="logopanel m-b">
                    </div>
                    <div class="m-b"></div>
                    <h2>欢迎使用</h2>
                    <h2>{:config('WEB_SITE_TITLE')}</h2>
                    <h2>管理系统</h2>
                    <ul class="m-b"></ul>
                </div>
            </div>
            <div class="col-sm-5" style="color:#fff">
                <form id="doLogin" name="doLogin" method="post" action="{:url('doLogin')}">
                    <p class="m-t-md" id="err_msg">登录到{:config('WEB_SITE_TITLE')}</p>
                    <input type="text" class="form-control uname" placeholder="用户名" id="username" name="username" />
                    <input type="password" class="form-control pword m-b" placeholder="密码" id="password" name="password" /> {if condition="$verify_type eq 1"}
                    <div style="margin-bottom:70px">
                        <input type="text" class="form-control" placeholder="验证码" style="color:black;width:120px;float:left;margin:0px 0px;" name="code" id="code" />
                        <img src="{:url('checkVerify')}" onclick="javascript:this.src='{:url('checkVerify')}?tm='+Math.random();" style="float:right;cursor: pointer" />
                    </div>
                    {else/}
                    <div id="slider" class="slider"></div>
                    {/if}
                    <button type="submit" class="btn btn-primary btn-block">登　录</button>
                </form>
            </div>
        </div>
        <div class="signup-footer">
            <div class="pull-left" style="color:#fff">
                &copy; 2020 {:config('WEB_SITE_TITLE')}管理系统 All Rights Reserved.
            </div>
        </div>
    </div>

    <script type="text/javascript" src="__JS__/bootstrap.min.js?v=3.3.6"></script>
    <script type="text/javascript" src="__JS__/jquery.form.js"></script>
    <script type="text/javascript" src="__JS__/layer/layer.js"></script>
    <script type="text/javascript" src="__JS__/lunhui.js"></script>
    <script type="text/javascript" src="__JS__/jquery.slider.min.js"></script>
    <script type="text/javascript">
        var check_result = false;
        $("#slider").slider({
            width: 233, // width
            height: 35, // height
            sliderBg: "rgb(232, 232, 232)", // 滑块背景颜色
            color: "rgb(114, 114, 114)", // 文字颜色
            fontSize: 14, // 文字大小
            bgColor: "#1ab394", // 背景颜色
            textMsg: "按住滑块，拖拽验证", // 提示文字
            successMsg: "验证成功", // 验证成功提示文字
            successColor: "#ffffff", // 滑块验证成功提示文字颜色
            time: 400, // 返回时间
            callback: function(result) { // 回调函数，true(成功),false(失败)
                check_result = result;
            }
        });


        $(function() {
            $('#doLogin').ajaxForm({
                beforeSubmit: checkForm, // 此方法主要是提交前执行的方法，根据需要设置
                success: complete, // 这是提交后的方法
                dataType: 'json'
            });

            function checkForm() {
                if ('' == $.trim($('#username').val())) {
                    lunhui.error('请输入登录用户名');
                    return false;
                }

                if ('' == $.trim($('#password').val())) {
                    lunhui.error('请输入登录密码');
                    return false;
                }

                if ('' == $.trim($('#code').val())) {
                    if (false == check_result) {
                        lunhui.error('填写验证码');
                        return false;
                    }
                }
                $('button').addClass('disabled').text('登录中...');
            }


            function complete(data) {
                if (data.code == 1) {
                    lunhui.success(data.msg, data.url);
                } else {
                    lunhui.error(data.msg);
                    $('#verity').attr('src','{:url('checkVerify')}?tm='+Math.random());
                    $('button').removeClass('disabled').text('登　录');
                    return false;
                }
            }
        });
    </script>
</body>

</html>